package com.franklin.java.configuration.sql.completion;


import com.franklin.java.api.state.BasePersistentState;
import com.franklin.java.api.state.BaseProjectPersistentState;
import com.franklin.java.entity.sql.ShowDescriptionType;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.project.Project;

/**
 * 代码提示设置持久化
 * @author Franklin
 * @since 2021/2/19 16:09
 */
@State(
    name = "com.franklin.java.configuration.sql.completion.CompletionSettingState",
    storages = {@Storage(StoragePathMacros.WORKSPACE_FILE)}
)
public class CompletionSettingState extends BaseProjectPersistentState<CompletionSettingState> {

    public boolean isUseCamel = true;

    public String description = ShowDescriptionType.COLUMN_COMMENT.getDescription();

    public boolean isShowEntityComment = true;

    public CompletionSettingState(Project myProject) {
        super(myProject);
    }

    public CompletionSettingState() {
    }

    public static CompletionSettingState getInstance(Project project){
        return project.getService(CompletionSettingState.class);
    }

    public static boolean isUseCamel(Project project){
        return getInstance(project).isUseCamel;
    }

    public static String getDescription(Project project){
        return getInstance(project).description;
    }

    public static boolean isShowEntityComment(Project project){
        return getInstance(project).isShowEntityComment;
    }
}
